package com.zzw.mvvm.pages.main;


import android.widget.TextView;

import com.zzw.mvvm.R;
import com.zzw.mvvm.base.BaseFragment;
import com.zzw.mvvm.viewmodels.main.MainViewModel;

import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import butterknife.BindView;

/**
 * A simple {@link Fragment} subclass.
 */
public class MainFragment extends BaseFragment<MainViewModel> {


    @BindView(R.id.f_tv)
    TextView fTv;


    @Override
    public int getLayoutId() {
        return R.layout.fragment_main;
    }

    @Override
    public void bindViewModel() {
        // viewModel = getModelProvider().get(MainViewModel.class);
        viewModel = createViewModel(MainViewModel.class);
        viewModel.getName().observe(this, new Observer<String>() {
            @Override
            public void onChanged(String s) {
                fTv.setText(s);
            }
        });

    }

    @Override
    public void onStart() {
        super.onStart();

    }
}
